The worldwide network of computers, commonly known as the “Internet,” has seen explosive growth in the last several years. This growth has been typically fueled by the introduction and widespread use of “web” browsers that allow for simple graphical user interface-based access to network servers. Such network servers typically support documents formatted as “web pages.” The “World Wide Web” (www) is a collection of servers on the Internet that utilize the Hypertext Transfer Protocol (HTTP), a known application protocol that provides users access to files using a standard page description language referred to as Hypertext Markup Language (HTML). It should be noted that files may be provided in different formats such as text, graphics, images, sound, and video, among others. HTML provides basic document formatting and allows a developer to specify “links” to other servers and files. Use of an HTML-compliant client browser involves specification of a link via a Uniform Resource Locator, commonly known by the acronym, “URL.” Upon specification of a URL, a client may make a TCP/IP (Transmission Control Protocol/Internet Protocol) request to the server identified in the link and receive a “web page” in return, where the “web page” is a document formatted according to HTML.
FIG. 1 illustrates a communication network based on a client-server model typically utilized in the Internet. Conceptually, the Internet comprises a large network of “sites” 110 that are accessible by “clients” 112. Each of the plurality of clients 112 is typically a user of a personal computer. Clients 112 access the Internet through some private Internet access provider 114 (such as Internet America™ or an on-line service provider 116 (such as America On-Line™, Prodigy, Microsoft Network™, and the like). Access provider 114 and service provider 116 will hereinafter be collectively referred to as the web servers. Furthermore, it should be noted that providers available on a web site are also known as web servers. Each of the clients 112 may run a “browser,” which is a known software tool used to access the sites 110 via the web servers (114 and 116). Each site 110 selectively operates a “web site” that supports files in the form of documents and pages. A network path to a server is identified by a uniform resource locator (URL) having a known syntax for defining a network connection. As previously mentioned, URLs may be utilized to specify a link from the user to another server or file. Upon specification of a link, one of the clients 112 makes a TCP/IP request to one of the plurality of sites 110 identified in the link and receives a web page (specifically, a document formatted according to HTML) in return. It should be noted that in some instances, a Java application may be executed without the use of a browser. Specifically, an applet viewer that runs independently of a browser may allow a user to actually view applets and similar Java applications across the Internet without having to use a browser.
In such a communication system, Java is a programming language that is often used to program applications made available on the Internet because Java is very flexible and may be easily used on any operating system, as long as that system implements a Java virtual machine. During execution of a Java-based application, a Java program is compiled into an architecture-neutral byte format that allows the application to be executed on any system platform that also implements the Java virtual machine.
It should be noted that the flexibility and neutrality of Java applications results from Java's implementation as an “interpreted” language. In interpreted languages, a compiler typically generates byte-codes to be used by a programming virtual machine, rather than native machine code, to provide control and data necessary to execute an application. More specifically, in Java, a Java compiler typically generates byte-codes to be used by the Java Virtual Machine (JVM), rather than native machine code, to provide the control and data signals necessary to execute a Java application. Subsequently, to actually execute a Java application, a Java interpreter executes the compiled byte-codes generated by the Java compiler. As previously mentioned, Java applications may be executed on any platform that the A JVM has been ported to as such byte-codes are platform-independent. An advantage of the interpreted environment is that a standard “compile” phase of program development is significantly diminished when viewed in contrast with the compile-link-run cycles required by programming languages such as C and C++.
In contrast, a disadvantage of interpreted programming languages, such as Java, is that that programming language is not executed as quickly as a compiled language, such as the C programming language. To boost the performance of applications written in Java, many Java interpreters include “Just In Time” (JIT) compilers that are able to translate certain Java byte-code segments into machine code for a particular central processing unit at run-time. This block of compiled code (also referred to as JIT'ed code) is then stored in a storage space, referred to as a “heap.”
By storing the JIT'ed code in a heap, the code may be repeatedly accessed and is not required to be compiled a second time. In current operating systems supporting Java, the heap is stored as part of the Java virtual machine. Therefore, heaps for storing the compiled code tend to grow larger until the memory space allocated for the heap is exceeded in current Java applications that implement JIT compilation. Upon exceeding the physical memory space, certain portions of the data stored within the heap are then transferred to a “paging file.” The paging file is a paging space, or an area on a disk, which is used to store physical memory data pages that may not be stored within a current memory used by an operating system or application.
When the “paged” data is required again, the data is retrieved from the disk and used again. While this methodology allows for the compiled code to be retrieved and not recompiled, this paging process requires an excessive amount of time and does not allow the heap to become smaller than a predefined size. This requirement may then result in an efficient use of memory within a Java virtual machine supporting a Java application.
Therefore, a need exists for a method and apparatus for managing a heap in a Java virtual machine to ensure efficient and timely execution of applications implemented using the Java programming language.